DEBUG=yes
CC=g++

ifeq ($(DEBUG),yes)
	CXXFLAGS=-W -Wall -Wextra -pedantic -g
	LDFLAGS=
else
	CXXFLAGS=-W -Wall -Wextra -pedantic -std=c++11
	LDFLAGS=
endif

EXEC=simulator.exe
SRC= $(wildcard *.cpp)
OBJ= $(SRC:.cpp=.o)

all: $(EXEC)

$(EXEC): $(OBJ)
	$(CC) -o $@ $^ $(LDFLAGS)

%.o: %.c
	$(CC) $(CXXFLAGS) -o $@ -c $<

.PHONY : clean
clean:
	@rm -f *.o *~ *.h.gch

#mrproper: clean
#	rm $(EXEC)

open:
	emacs *.cpp *.h &
